home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / dodge.swf / scripts / __Packages / StraightMissile.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  1.8 KB  |  67 lines

  1. class StraightMissile extends Missile
  2. {
  3.    var angleRad;
  4.    var tm;
  5.    var mc;
  6.    var newAngle;
  7.    var dm;
  8.    static var MAX_SPEED = 10;
  9.    static var DAMAGE = 3;
  10.    static var MISSILE_TIMER = 60;
  11.    static var GRACE_TIMER = 3;
  12.    static var missiles = new ObjectList();
  13.    function StraightMissile(x, y, newAngle)
  14.    {
  15.       super(x,y,newAngle);
  16.       this.angleRad = CustomMath.degToRad(newAngle);
  17.       this.xspeed = Math.cos(this.angleRad) * this.getMaxSpeed();
  18.       this.yspeed = Math.sin(this.angleRad) * this.getMaxSpeed();
  19.    }
  20.    function getMaxSpeed()
  21.    {
  22.       return StraightMissile.MAX_SPEED;
  23.    }
  24.    function getDamage()
  25.    {
  26.       return StraightMissile.DAMAGE;
  27.    }
  28.    function getMissileTimer()
  29.    {
  30.       return StraightMissile.MISSILE_TIMER;
  31.    }
  32.    function getGraceTimer()
  33.    {
  34.       return StraightMissile.GRACE_TIMER;
  35.    }
  36.    function createTrailManager()
  37.    {
  38.       this.tm = new EfficientTrailManager(this.mc,this.mc.exhaust1,4,_root.effects < 3 ? null : 16226057,this.getTrailLength(),true,100,this.newAngle);
  39.    }
  40.    function createDebrisManager()
  41.    {
  42.       if(_root.effects >= 2)
  43.       {
  44.          this.dm = new DebrisManager(16226057,1);
  45.       }
  46.    }
  47.    function createSound()
  48.    {
  49.       SoundManager.fireOrangeMissile();
  50.    }
  51.    function followPlayer()
  52.    {
  53.       this.mc._x += this.xspeed;
  54.       this.mc._y += this.yspeed;
  55.       this.tm.makeTrail(this.angleRad);
  56.    }
  57.    function hit(m, shapeFlag, isPlayer)
  58.    {
  59.       if(isPlayer || !this.isGrace())
  60.       {
  61.          var _loc2_ = CustomMath.degToRad(this.newAngle);
  62.          return m.hitTest(this.mc._x,this.mc._y,shapeFlag) || m.hitTest(this.mc._x + Math.cos(_loc2_) * (this.getMaxSpeed() >> 1),this.mc._y + Math.sin(_loc2_) * (this.getMaxSpeed() >> 1),shapeFlag);
  63.       }
  64.       return false;
  65.    }
  66. }
  67.